# Metview Macro

#  **************************** LICENSE START ***********************************
# 
#  Copyright 2015 ECMWF. This software is distributed under the terms
#  of the Apache License version 2.0. In applying this license, ECMWF does not
#  waive the privileges and immunities granted to it by virtue of its status as
#  an Intergovernmental Organization or submit itself to any jurisdiction.
# 
#  ***************************** LICENSE END ************************************

lines = read('params.txt')
print(lines) # lines is a list of strings

params = lines[2] # take the second line; params is a string
param_list = parse(params, '/') # split the string into a list of strings
print(param_list)


# write out to a new file

out_file = 'params_out.txt'
write(out_file, 'Parameters:' & newline)
param_list_string = nil
for i = 1 to count(param_list) do
    param_list_string = param_list_string & param_list[i] & '/'
end for
append(out_file, param_list_string)